//
//  TKIssueTitleHearderView.m
//  Ticket
//
//  Created by 小禹宝宝 on 2017/10/14.
//  Copyright © 2017年 cy55. All rights reserved.
//

#import "TKIssueTitleHearderView.h"


#define MAX_LIMIT_NUMS 15

@interface TKIssueTitleHearderView ()
@end
@implementation TKIssueTitleHearderView

-(void)awakeFromNib {
    [super awakeFromNib];
    self.titleTextField.tintColor = [BLColorConfig mainColor];
//    self.backgroundColor = [BLColorConfig backgroundColor];
    [self.titleTextField addTarget:self action:@selector(textFieldEditChanged:) forControlEvents:UIControlEventEditingChanged];

}

- (NSString *)issueTitleText {
    _issueTitleText = self.titleTextField.text;
    return _issueTitleText;
}


- (void)textFieldEditChanged:(UITextField *)textField
{
//    NSLog(@"textfield EditChanged text %@",textField.text);
    NSString  *nsTextContent = textField.text;
    NSInteger existTextNum = nsTextContent.length;
    
    if (existTextNum > MAX_LIMIT_NUMS)
    {
        //截取到最大位置的字符
        NSString *s = [nsTextContent substringToIndex:MAX_LIMIT_NUMS];
        
        [textField setText:s];
        [self ks_showToast:@"您输入的文本太长啦"];
    }
    
}
@end
